﻿using System;
using TYBase;

namespace EVEPreChargeDataMonitor.Data
{
    public class AppIniData
    {
        public static DateTime LastCheckTime { get; set; } = DateTime.MinValue;

        public static string CheckDir = "d:\\dsData";
        public static string ConnectString { get; set; } = "Server=192.168.0.101;Port=3306;Database=db_battery_check;uid=root;pwd=Aa123456 ;default command timeout=20;";


        public static void Init()
        {
            LastCheckTime = AppData.ini.ReadString(nameof(LastCheckTime), "").AsTime(DateTime.MinValue);
            CheckDir = AppData.ini.ReadString(nameof(CheckDir), CheckDir);
            ConnectString = AppData.ini.ReadString(nameof(ConnectString), ConnectString);

            AppData.ini.WriteString(nameof(LastCheckTime), LastCheckTime.AsString());
            AppData.ini.WriteString(nameof(CheckDir), CheckDir);
            AppData.ini.WriteString(nameof(ConnectString), ConnectString);

        }
    }
}
